package com.woniu.after.config;

import com.woniu.after.entity.MinioProperties;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Minio配置类
 */
@Configuration
public class MinioConfig {
    @Autowired
    private MinioProperties minioProperties;

    /**
     * 获取minio客户端
     * @return
     */
    @Bean
    public MinioClient minioClient() {
//       return MinioClient.builder().endpoint(minioProperties.getEndpoint())
//               .credentials(minioProperties.getAccessKey(), minioProperties.getSecretKey()).build();
        return MinioClient.builder().endpoint(minioProperties.getEndpoint())
                .credentials(minioProperties.getAccesskey(), minioProperties.getSecretKey()).build();
    }
}